Definition

A random hash function h:𝒰{1,,m}h: \mathcal{U} \rightarrow \{1,…,m\} is universal if, for any fixed x,y𝒰x,y \in \mathcal{U},

Pr[h(x)=h(y)]1m\mathrm{Pr}[h(x)=h(y)] \leq \frac{1}{m}

Efficient construction: Let pp be a prime number between |𝒰||\mathcal{U}| and 2|𝒰|2|\mathcal{U}|. Let aa, bb be random numbers in 0,,p0,…,p, a0a \neq 0.

h(x)=[ax+b(modp)](modm)h(x) = [a \cdot x + b \pmod p] \pmod m

is universal.


See also: Hashing
Compare: uniformly random hash function